@extends("layout.admin")

@section("title")
    成员管理
@endsection

@section("content")
    {{--列表--}}
    <div class="layui-card-body">
        <form id="search-form">
            <input type="hidden" name="batch_id" value="{{request('batch_id')}}">
            <input type="hidden" name="basic_id" value="{{request('basic_id')}}">
        </form>
        <div><h3>考场名称：{{$basic}}&nbsp;&nbsp;考试批次：{{$batch}}</h3></div>
        <script type="text/html" id="toolbar">
            <div class="layui-btn-container">
                @if(_can('admin.basic.membercreate'))
                    <a class="layui-btn layui-btn-sm" onclick="window.location.href='{{route("admin.basic.membercreate",['batch_id'=>request('batch_id'),'basic_id'=>request('basic_id')])}}'"><i class="layui-icon"></i>添加成员</a>
                @endif

                    <a class="layui-btn layui-btn-sm" href="{{route('admin.basic.examindex',['basic_id'=>request('basic_id')])}}"><i class="layui-icon"></i>返回上级</a>
            </div>
        </script>
        <table lay-filter="table-hide" style="display: none"  id="demo" lay-data="{height:'full-310', cellMinWidth: 80,toolbar: '#toolbar',defaultToolbar:['filter'],limit:{{$data['per_page']}}}">
            <thead>
            <tr>
                <th lay-data="{field:'user_name'}">用户名</th>
                <th lay-data="{field:'created_at'}">创建时间</th>
                <th lay-data="{field:'updated_at'}">更新时间</th>
                <th lay-data="{field:'op',fixed: 'right', width:220, align:'center'}">操作</th>
            </tr>
            </thead>
            <tbody>
            @foreach ($data['data'] as $vo)
                <tr>
                    <td>{{$vo['user_name']}}</td>
                    <td>{{ $vo['created_at'] }}</td>
                    <td>{{ $vo['updated_at'] }}</td>
                    <td>
                        @if(_can('admin.basic.memberdestroy'))
                            <a class="layui-btn layui-btn-xs layui-btn-danger" onclick="admin.tableDataDelete('{{ route("admin.basic.memberdestroy",['batch_id'=>$vo['batch_id'],'user_id'=>$vo['user_id']]) }}', this,'确认移除吗')">移除</a>
                        @endif
                    </td>
                </tr>
            @endforeach
            </tbody>
        </table>
        @include("layout.page")
    </div>
@endsection

@section('script')
    <script src="{{asset('layui/modules/xm-select.js')}}"></script>
    <script src="{{asset('js/tree/select.js')}}"></script>
    <script>
        var idx=-1;
        layui.use(['form', 'table', 'layer'], function () {
            var table = layui.table;
            var form = layui.form;
            table.init("table-hide");
            admin.paginate("{{ $data['total'] }}", "{{ $data['current_page'] }}", "{{ $data['per_page'] }}");

        });
    </script>
    <script src="{{asset('js/layCommon.js')}}"></script>
@endsection

